<!DOCTYPE html>
<html>
  <head>
    <title>WebSocket Example</title>
  </head>
  <body>
    <h1>WebSocket Client</h1>
    <div id="messages"></div>
    <script type="text/javascript">
      // var xhr = new XMLHttpRequest();
      // var getUrl = "/faceSwapVideoLook?promptId=" + promptId;
      // xhr.open("GET",getUrl, true)
      // xhr.onload = function(){
      
      
      var ws = new WebSocket("ws://127.0.0.1:8888/ws");
      
      ws.onmessage = function(event) {
        var messages = document.getElementById("messages");
        var message = document.createElement("div");
        message.textContent = event.data;
        messages.appendChild(message);
      };
      
      // 发送测试消息
      ws.onopen = function() {
        ws.send("Hello, this is a special message!");
      };
    </script>
  </body>
</html>